home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / include / user / RCS / fs.h,v < prev    next >
Encoding:
Text File  |  1992-07-17  |  23.0 KB  |  718 lines

  1. head     1.3;
  2. branch   ;
  3. access   ;
  4. symbols  srv030:1.3 srv027:1.3 srv026:1.3 srv024:1.3 srv021:1.3 srv019:1.3 srv018:1.3 srv016:1.3 srv014:1.3 srv010:1.3 srv008:1.3 srv007:1.3 srv006:1.3 srv005:1.3 srv004:1.3 srv003:1.3 srv002:1.3 srv001:1.3;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.3
  10. date     91.12.12.22.23.07;  author kupfer;  state Exp;
  11. branches ;
  12. next     1.2;
  13.  
  14. 1.2
  15. date     91.12.01.22.28.35;  author kupfer;  state Exp;
  16. branches ;
  17. next     1.1;
  18.  
  19. 1.1
  20. date     91.08.15.18.32.56;  author kupfer;  state Exp;
  21. branches ;
  22. next     ;
  23.  
  24.  
  25. desc
  26. @Definitions and types used in the user's interface to the filesystem.
  27. @
  28.  
  29.  
  30. 1.3
  31. log
  32. @Add IOC_READ, IOC_WRITE.
  33. @
  34. text
  35. @/*
  36.  * fs.h --
  37.  *
  38.  *    Definitions and types used in the user's interface to
  39.  *    the filesystem.
  40.  *
  41.  * Copyright 1985, 1988, 1991 Regents of the University of California
  42.  * Permission to use, copy, modify, and distribute this
  43.  * software and its documentation for any purpose and without
  44.  * fee is hereby granted, provided that this copyright
  45.  * notice appears in all copies.  The University of California
  46.  * makes no representations about the suitability of this
  47.  * software for any purpose.  It is provided "as is" without
  48.  * express or implied warranty.
  49.  *
  50.  * $Header: /r3/kupfer/spriteserver/include/user/RCS/fs.h,v 1.2 91/12/01 22:28:35 kupfer Exp Locker: kupfer $ SPRITE (Berkeley)
  51.  */
  52.  
  53. #ifndef _FS_H
  54. #define _FS_H
  55.  
  56. #ifndef _MiG
  57. #include <mach.h>
  58. #include <spriteTime.h>
  59. #ifdef SPRITED
  60. #include <user/proc.h>
  61. #else
  62. #include <proc.h>
  63. #endif /* SPRITED */
  64. #endif /* _MiG */
  65.  
  66. /*
  67.  * The macros major and minor are defined in sys/types.h.  They are also
  68.  * the names of fields in a structure defined in fs.h.  Only gcc and ANSI
  69.  * C are clever enough to handle this.  (The field name isn't followed
  70.  * by an open paren...)  So, if you include this file and <sys/types.h>
  71.  * then you can use the major() and minor() macros.  However, <sys/types.h>
  72.  * also defines unix_major() and unix_minor, so you can use those.
  73.  */
  74. #ifndef __STDC__ 
  75. #ifdef major
  76. #undef    major
  77. #endif
  78. #ifdef minor 
  79. #undef    minor
  80. #endif 
  81. #endif /* ! __STDC__ */
  82.  
  83. /*
  84.  * Global constants.
  85.  * FS_BLOCK_SIZE - the size of filesystem blocks
  86.  * FS_MAX_PATH_NAME_LENGTH - the maximum length of a complete pathname.
  87.  * FS_MAX_NAME_LENGTH - is the maximum length of one component of a name.
  88.  */
  89. #define    FS_BLOCK_SIZE        4096
  90. #define FS_MAX_PATH_NAME_LENGTH    1024
  91. #define FS_MAX_NAME_LENGTH    255
  92.  
  93. /* 
  94.  * These constants are used to ensure that the MIG-generated size for a 
  95.  * type agrees with its actual size.
  96.  */
  97. #define FS_ATTRIBUTES_SIZE    28    /* ints in an Fs_Attributes */
  98. #define FS_DEVICE_SIZE        6    /* ints in an Fs_Device */
  99.  
  100. #ifndef _MiG
  101.  
  102.  
  103.  
  104. /*
  105.  * Open stream flags that are passed to Fs_Open from user programs.  These
  106.  *    flags are kept in a kernel data structure along with some other
  107.  *    flags used by the operating system internally.  This fact is only
  108.  *    important to pseudo-device and pseudo-file-system servers which
  109.  *    may see the other flags, which are defined in <kernel/fs.h>.
  110.  *
  111.  *    FS_READ        - open the file for read access.
  112.  *    FS_WRITE    - open the file for write access, can be combined
  113.  *              with FS_READ
  114.  *    FS_EXECUTE    - open the file for execute access.  This mode is used
  115.  *              by the kernel when opening a.out files.  It can
  116.  *              be used to limit the open to executables files.
  117.  *    FS_APPEND    - open for append mode. All writes get appended to the
  118.  *              end of the file regardless of the file pointer.
  119.  *    FS_CLOSE_ON_EXEC - close the stream when the process execs.
  120.  *    FS_NON_BLOCKING - I/O operations don't block (if applicable) but
  121.  *              instead return FS_WOULD_BLOCK.
  122.  *    FS_CREATE    - create the file if it doesn't exist.
  123.  *    FS_TRUNC    - truncate the file to zero length.
  124.  *    FS_EXCLUSIVE    - If specified with FS_CREATE the open/create will
  125.  *              fail if the file already exists.
  126.  *    FS_NAMED_PIPE_OPEN - Open as a named pipe. (NOT IMPLEMENTED)
  127.  *    FS_PDEV_MASTER     - Caller wants to be master of the pseudo-device.
  128.  *    FS_PFS_MASTER     - Caller wants to be server of the pseudo-filesystem.
  129.  */
  130. #define FS_USER_FLAGS              0xfff
  131. #define FS_READ                  0x001
  132. #define FS_WRITE              0x002
  133. #define FS_EXECUTE              0x004
  134. #define FS_APPEND              0x008
  135. #define FS_CLOSE_ON_EXEC        0x010
  136. #define FS_PDEV_MASTER            0x020
  137. #define FS_NAMED_PIPE_OPEN        0x040
  138. #define    FS_PFS_MASTER            0x080
  139. #define FS_NON_BLOCKING            0x100
  140. #define FS_CREATE              0x200
  141. #define FS_TRUNC              0x400
  142. #define FS_EXCLUSIVE              0x800
  143. /*            More high order bits are defined in <kernel/fs.h> !! */
  144.  
  145. /*
  146.  * Flags for Fs_Select:
  147.  *
  148.  *    FS_READABLE    - Does the stream have data that can be read?
  149.  *    FS_WRITABLE    - Can data be written to the stream?
  150.  *    FS_EXCEPTION    - Are there any exception conditions that have
  151.  *              raised for the stream? (e.g. out-of-band data).
  152.  */
  153.  
  154. #define FS_READABLE    FS_READ
  155. #define FS_WRITABLE    FS_WRITE
  156. #define FS_EXCEPTION    FS_EXECUTE
  157. #define FS_EXCEPTABLE    FS_EXCEPTION
  158.  
  159.  
  160.  
  161. /*
  162.  * The Fs_Attributes type is the information returned about a file
  163.  * from the Fs_GetAttributes and Fs_GetAttributesID system calls.
  164.  * This struct is also the input parameter for the Fs_SetAttributes
  165.  * and Fs_SetAttributesID system calls.
  166.  */
  167. typedef struct Fs_Attributes {
  168.     int    serverID;        /* Host ID of file server */
  169.     int domain;            /* Server-relative domain number of the file */
  170.     int fileNumber;        /* Domain-relative file number */
  171.     int type;            /* File types defined below */
  172.     int size;            /* Number of bytes in the file */
  173.     int numLinks;        /* Number of directory references to the file */
  174.     unsigned int permissions;    /* Permission bits defined below */
  175.     int uid;            /* User ID of file's owner */
  176.     int gid;            /* ID of file's owning group */
  177.     int devServerID;        /* ID of device server */
  178.     int devType;        /* Type of the device */
  179.     int devUnit;        /* Interpreted by the device driver */
  180.     Time createTime;        /* Time of the files creation */
  181.     Time accessTime;        /* Time of last access to the file */
  182.     Time descModifyTime;    /* Time the file descriptor was last modified */
  183.     Time dataModifyTime;    /* Time the file's data was last modified */
  184.     int  blocks;        /* The number of blocks taken by the file */
  185.     int  blockSize;        /* The size of each block */
  186.     int    version;        /* This is incremented when file is written */
  187.     int userType;        /* User defined file type */
  188.     int pad[4];            /* Reserved */
  189. } Fs_Attributes;
  190.  
  191. /*
  192.  * The following are values for the fileOrLink argument to Fs_Set/GetAttributes.
  193.  *    FS_ATTRIB_LINK    Get the attributes of the named link, not of the
  194.  *        file the link refers to.
  195.  *    FS_ATTRIB_FILE    Get the attributes of the name file.  If the last
  196.  *        component of the file name is a link then use the file
  197.  *        to which the link refers.
  198.  */
  199. #define FS_ATTRIB_LINK            1
  200. #define FS_ATTRIB_FILE            2
  201.  
  202. /*
  203.  * The following are values for the flags passed to Fs_SetAttr and Fs_SetAttrID
  204.  *    FS_SET_ALL_ATTRS - Attempt to set all settable attributes (see below)
  205.  *    FS_SET_TIMES    - Set data modify and file access times.
  206.  *    FS_SET_MODE    - Set the permission mode bits of the file.
  207.  *    FS_SET_OWNER    - Set the owner and group owner of a file.
  208.  *    FS_SET_FILE_TYPE - Set the user-defined file type of a file.
  209.  *    FS_SET_DEVICE    - Set device attributes - server, type, unit
  210.  */
  211. #define FS_SET_ALL_ATTRS    0x1F
  212. #define FS_SET_TIMES        0x01
  213. #define FS_SET_MODE        0x02
  214. #define FS_SET_OWNER        0x04
  215. #define FS_SET_FILE_TYPE    0x08
  216. #define FS_SET_DEVICE        0x10
  217.  
  218. /*
  219.  * FS_LOCALHOST_ID is used as the device server ID for generic devices,
  220.  * those expected to exist on all hosts.  It is also used in the kernel
  221.  * when the "ioServerID" is the local host.
  222.  */
  223. #define FS_LOCALHOST_ID        -1
  224.  
  225. /*
  226.  * File types kept in FsFileDescriptors on disk:
  227.  *    FS_FILE            ordinary disk file
  228.  *    FS_DIRECTORY        file used to implement the directory stucture
  229.  *    FS_SYMBOLIC_LINK    regular file used to implement links
  230.  *    FS_REMOTE_LINK        symbolic link used to mark the top of a domain
  231.  *    FS_DEVICE        Placeholder for peripheral device
  232.  *    FS_REMOTE_DEVICE    not used
  233.  *    FS_LOCAL_PIPE        Temporary half-duplex pipe
  234.  *    FS_NAMED_PIPE        Persistent half-duplex pipe (not implemented)
  235.  *    FS_PSEUDO_DEV        Full duplex communication to a user process
  236.  *    FS_PSEUDO_FS        Marks a domain controlled by a user process
  237.  *    FS_XTRA_FILE        Extra file type used to stage the
  238.  *                (re)implementation of standard file types
  239.  */
  240.  
  241. #define    FS_FILE                0
  242. #define    FS_DIRECTORY            1
  243. #define    FS_SYMBOLIC_LINK        2
  244. #define    FS_REMOTE_LINK            3
  245. #define    FS_DEVICE            4
  246. #define    FS_REMOTE_DEVICE        5
  247. #define    FS_LOCAL_PIPE            6
  248. #define    FS_NAMED_PIPE            7
  249. #define    FS_PSEUDO_DEV            8
  250. #define FS_PSEUDO_FS            9
  251. #define FS_XTRA_FILE            10
  252.  
  253.  
  254. /*
  255.  * User-defined file types.  A number of types are standardized, but others
  256.  * may be defined by the user.
  257.  *
  258.  *     FS_USER_TYPE_UNDEFINED        - no type set
  259.  *     FS_USER_TYPE_TMP              - temporary file
  260.  *     FS_USER_TYPE_SWAP             - swap file
  261.  *     FS_USER_TYPE_OBJECT           - ".o" file
  262.  *     FS_USER_TYPE_BINARY           - executable
  263.  *     FS_USER_TYPE_OTHER           - file that doesn't correspond to any
  264.  *                      specific type.  This is distinct from
  265.  *                      undefined, which says the type is
  266.  *                      uninitialized and may be inferred by
  267.  *                      parent directory or file name.
  268.  */
  269. #define FS_USER_TYPE_UNDEFINED  0
  270. #define FS_USER_TYPE_TMP        1
  271. #define FS_USER_TYPE_SWAP    2
  272. #define FS_USER_TYPE_OBJECT    3
  273. #define FS_USER_TYPE_BINARY    4
  274. #define FS_USER_TYPE_OTHER    5
  275.  
  276.  
  277. /*
  278.  * The Fs_FileID and Fs_UserIDs types are exported to user-level so that
  279.  * pseudo-filesystem servers can understand the arguments to lookup operations
  280.  * that are defined in fsNameOps.h
  281.  *
  282.  * Fs_FileID - Uniquely identify a filesystem object.  A type is the first
  283.  *    field, the hostID of the server is next, and the remaining fields 
  284.  *    are interpreted by the implementation of that type of filesystem object
  285.  *    (ie. files, devices, pipes, pseudo-devices, etc.)
  286.  *    A global hash table of filesystem objects, (called "handles")
  287.  *    is maintained with this Fs_FileID as the hash key.
  288.  */
  289. typedef struct Fs_FileID {
  290.     int        type;        /* Defined in kernel fsio.h (stream types).
  291.                  * Used in I/O switch, and implicitly
  292.                  * indicates what kind of structure follows
  293.                  * the FsHandleHeader in the Handle. */
  294.     int        serverID;    /* Host that controls the object.  (This would
  295.                  * have to be a multi-cast ID for objects
  296.                  * that support replication.) */
  297.     int        major;        /* First type specific identifier. */
  298.     int        minor;        /* Second type sepcific identifier. */
  299. } Fs_FileID;            /* 16 BYTES */
  300.  
  301. /*
  302.  *    The FS_NUM_GROUPS constant limits the number of group IDs that
  303.  *    are used even though the proc table supports a variable number.
  304.  */
  305. #define FS_NUM_GROUPS    8
  306.  
  307. typedef struct Fs_UserIDs {
  308.     int user;            /* Indicates effective user ID */
  309.     int numGroupIDs;        /* Number of valid entries in groupIDs */
  310.     int group[FS_NUM_GROUPS];    /* The set of groups the user is in */
  311. } Fs_UserIDs;            /* 40 BYTES */
  312.  
  313.  
  314.  
  315.  
  316. /*
  317.  * Generic IO Control operations.
  318.  *    IOC_REPOSITION        Reposition the current offset into the file.
  319.  *    IOC_GET_FLAGS        Return the flags associated with the stream.
  320.  *    IOC_SET_FLAGS        Set all the flags for the stream.
  321.  *    IOC_SET_BITS        Set some of the flags for the stream.
  322.  *    IOC_CLEAR_BITS        Clear some of the flags for the stream.
  323.  *    IOC_TRUNCATE        Truncate the stream to a given length.
  324.  *    IOC_LOCK        Lock the stream or underlying file.
  325.  *    IOC_UNLOCK        Unlock the stream.
  326.  *    IOC_NUM_READABLE    Return the number of bytes available.
  327.  *    IOC_GET_OWNER        Return the process or family that gets signals.
  328.  *    IOC_SET_OWNER        Set the process or family that gets signals.
  329.  *    IOC_MAP            Map the stream into the processes VM
  330.  *    IOC_PREFIX        Get the prefix under which the stream was
  331.  *                opened.  This is useful if a server is exporting
  332.  *                a domain under more than one name.  The getwd()
  333.  *                library call uses this feature.
  334.  *    IOC_WRITE_BACK        Write back any cached stream data.
  335.  *    IOC_MMAP_INFO        Provide server with information on
  336.  *                VM memory mapping.
  337.  *
  338.  *    IOC_GENERIC_LIMIT    This is the maximum IOC number that can be
  339.  *                used for the generic I/O controls supported
  340.  *                by the kernel.  Device drivers define I/O
  341.  *                control numbers above this limit.  This limit
  342.  *                is used in the kernel to optimize handling
  343.  *                generic vs. non-generic I/O controls.
  344.  */
  345.  
  346. #define    IOC_REPOSITION            1
  347. #define    IOC_GET_FLAGS            2
  348. #define IOC_SET_FLAGS            3
  349. #define IOC_SET_BITS            4
  350. #define IOC_CLEAR_BITS            5
  351. #define IOC_TRUNCATE            6
  352. #define IOC_LOCK            7
  353. #define IOC_UNLOCK            8
  354. #define IOC_NUM_READABLE        9
  355. #define IOC_GET_OWNER            10
  356. #define IOC_SET_OWNER            11
  357. #define IOC_MAP                12
  358. #define IOC_PREFIX            13
  359. #define IOC_WRITE_BACK            14
  360. #define    IOC_MMAP_INFO            15
  361. #define IOC_GENERIC_LIMIT        ((1<<16)-1)
  362.  
  363. /*
  364.  * Maximum number of bytes that be copied in on an iocontrol.
  365.  */
  366.  
  367. #define    IOC_MAX_BYTES    4096
  368.  
  369.  
  370. /*
  371.  * IOC_REPOSITION - reposition the file access position.
  372.  */
  373.  
  374. typedef struct Ioc_RepositionArgs {
  375.     int base;    /* Base at which to start reposition: defines below */
  376.     int offset;    /* Offset from base */
  377. } Ioc_RepositionArgs;
  378.  
  379. /*
  380.  * Base argument definitions:
  381.  *    IOC_BASE_ZERO        base is the beginning of the file.
  382.  *    IOC_BASE_CURRENT    base is the current position in the file.
  383.  *    IOC_BASE_EOF        base is the end of the file.
  384.  */
  385.  
  386. #define IOC_BASE_ZERO        0
  387. #define IOC_BASE_CURRENT    1
  388. #define IOC_BASE_EOF        2
  389.  
  390.  
  391.  
  392. /*
  393.  *    IOC_GET_FLAGS        Return the flags associated with the stream.
  394.  *    IOC_SET_FLAGS        Set all the flags for the stream.
  395.  *    IOC_SET_BITS        Set some of the flags for the stream.
  396.  *    IOC_CLEAR_BITS        Clear some of the flags for the stream.
  397.  *
  398.  *    A few of the low order bits in the flags field are reserved
  399.  *    for use by the kernel.  The rest bits are left for interpretation
  400.  *    by the (pseudo) device driver.
  401.  *        IOC_APPEND    Do append mode writes to the stream
  402.  *        IOC_NON_BLOCKING Do not block if I/O is not ready
  403.  *        IOC_ASYNCHRONOUS Dispatch I/O and signal when complete
  404.  *                 This is not implemented yet, 6/87
  405.  *        IOC_CLOSE_ON_EXEC This forces the stream to be closed when
  406.  *                the process execs another program.
  407.  *        IOC_READ    Stream is open for reading.
  408.  *        IOC_WRITE    Stream is open for writing.
  409.  */
  410.  
  411. #define IOC_GENERIC_FLAGS    0xFF
  412. #define    IOC_APPEND        0x01
  413. #define IOC_NON_BLOCKING    0x02
  414. #define IOC_ASYNCHRONOUS    0x04
  415. #define IOC_CLOSE_ON_EXEC    0x08
  416. #define IOC_READ        0x10
  417. #define IOC_WRITE        0x20
  418.  
  419.  
  420. /*
  421.  *    IOC_LOCK        Lock the stream or underlying file.
  422.  *    IOC_UNLOCK        Unlock the stream.
  423.  */
  424. typedef struct Ioc_LockArgs {
  425.     int        flags;        /* IOC_LOCK_EXCLUSIVE, no other locks allowed
  426.                  * IOC_LOCK_SHARED, can have many of these,
  427.                  *    but no exclusive locks 
  428.                  * IOC_LOCK_NO_BLOCK, don't block if the lock
  429.                  *    can't be obtained, return FS_WOUD_BLOCK
  430.                  */
  431.     /*
  432.      * The following fields are set by the kernel and used by
  433.      * lower levels to notify when the lock is obtainable.  Pseudo-device
  434.      * masters use IOC_PDEV_LOCK_READY IOControl to do this notify.
  435.      */
  436.     int        hostID;        /* Set by the kernel */
  437.     Proc_PID    pid;        /* Set by the kernel */
  438.     int        token;        /* Set by the kernel */
  439. } Ioc_LockArgs;
  440.  
  441. #define IOC_LOCK_SHARED            0x1
  442. #define IOC_LOCK_EXCLUSIVE        0x2
  443. #define IOC_LOCK_NO_BLOCK        0x8
  444.  
  445. /*
  446.  *    IOC_GET_OWNER        Return the process or family that gets signals.
  447.  *    IOC_SET_OWNER        Set the process or family that gets signals.
  448.  */
  449. typedef struct Ioc_Owner {
  450.     Proc_PID    id;        /* Process or Family ID */
  451.     int        procOrFamily;    /* IOC_OWNER_FAMILY or IOC_OWNER_PROC */
  452. } Ioc_Owner;
  453.  
  454. #define IOC_OWNER_FAMILY    0x1
  455. #define IOC_OWNER_PROC        0x2
  456.  
  457. /*
  458.  *    IOC_MAP            Map the stream into the processes VM
  459.  */
  460. typedef struct Ioc_MapArgs {
  461.     int        numBytes;
  462.     Address    address;
  463. } Ioc_MapArgs;
  464.  
  465. /*
  466.  *    IOC_PREFIX        Return prefix under which stream was opened.
  467.  */
  468. typedef struct Ioc_PrefixArgs {
  469.     char    prefix[FS_MAX_PATH_NAME_LENGTH];  /* Set by kernel */
  470. } Ioc_PrefixArgs;
  471.  
  472. /*
  473.  *    IOC_WRITE_BACK        Write back the cached data of a file.
  474.  *                Although the arguments are in terms
  475.  *                of bytes, the cache will block align
  476.  *                the write-back so the bytes are fully
  477.  *                included in the blocks written back.
  478.  */
  479. typedef struct Ioc_WriteBackArgs {
  480.     int        firstByte;    /* Index of first byte to write back */
  481.     int        lastByte;    /* Index of last byte to write back */
  482.     Boolean    shouldBlock;    /* If TRUE, call blocks until write back done */
  483. } Ioc_WriteBackArgs;
  484.  
  485. /*
  486.  *    IOC_MMAP_INFO        Give information to the server that a
  487.  *                client is mapping a stream into memory.
  488.  */
  489. typedef struct Ioc_MmapInfoArgs {
  490.     int        isMapped;    /* 1 if mapping, 0 if unmapping. */
  491.     int        clientID;    /* ID of the requesting client. */
  492. } Ioc_MmapInfoArgs;
  493.  
  494. /*
  495.  * A mask of 9 permission bits is used to define the permissions on a file.
  496.  * A mask like this occurs in the FileDescriptor for a file.  A mask like
  497.  * this is also part of the state of each process.  It defines the maximal
  498.  * set of permissions that a newly created file can have. The following
  499.  * define the various permission bits.
  500.  *    FS_OWNER_{READ|WRITE|EXEC}    A process with a UID that matches the
  501.  *            file's UID has {READ|WRITE|EXEC} permission on the file.
  502.  *    FS_GROUP_{READ|WRITE|EXEC}    A process with one of its group IDS
  503.  *            that matches the file's GID has permission...
  504.  *    FS_WORLD_{READ|WRITE|EXEC}    Any process has permission if WORLD
  505.  *            permission bits are set.
  506.  */
  507. #define FS_OWNER_READ            00400
  508. #define FS_OWNER_WRITE            00200
  509. #define FS_OWNER_EXEC            00100
  510. #define FS_GROUP_READ            00040
  511. #define FS_GROUP_WRITE            00020
  512. #define FS_GROUP_EXEC            00010
  513. #define FS_WORLD_READ            00004
  514. #define FS_WORLD_WRITE            00002
  515. #define FS_WORLD_EXEC            00001
  516.  
  517. /*
  518.  * Other permission bits:
  519.  *    FS_SET_UID    This bit set on a program image or shell script
  520.  *        causes the execed process to take on the user id of
  521.  *        the file.  (Thanks to Dennis Ritchie for this great idea.)
  522.  *    FS_SET_GID    As above, but for the group id.
  523.  */
  524. #define FS_SET_UID            04000
  525. #define FS_SET_GID            02000
  526.  
  527.  
  528.  
  529. /*
  530.  * Values of the mode argument to the Fs_CheckAccess system call.
  531.  *    FS_EXISTS    does the file exists (can the caller see it)
  532.  *    FS_READ        does the caller have read access
  533.  *    FS_WRITE    does the caller have write access
  534.  *    FS_EXECUTE    does the caller have execution access
  535.  */
  536. #define FS_EXISTS        0x0
  537.  
  538. /*
  539.  * Flag to Fs_GetNewID call that says choose any new stream ID.
  540.  */
  541. #define FS_ANYID            -1
  542.  
  543. /*
  544.  * The Fs_AttachDisk system call takes flags that affect just what is
  545.  * done with the disk partition and the associated prefix.
  546.  *    FS_ATTACH_READ_ONLY    Set the disk up to be read only.
  547.  *    FS_DETACH        The disk becomes inaccessible.  Any modified
  548.  *                filesystem data is flushed first.
  549.  *    FS_ATTACH_LOCAL        The disk is attached locally and not exported
  550.  *    FS_DEFAULT_DOMAIN    The domain is being attached by the kernel
  551.  *                during boot as the default.
  552.  *
  553.  */
  554. #define FS_ATTACH_READ_ONLY        0x1
  555. #define FS_DETACH            0x2
  556. #define FS_ATTACH_LOCAL            0x4
  557. #define FS_DEFAULT_DOMAIN        0x8
  558.  
  559. typedef struct Fs_TwoPaths {
  560.     int        pathLen1;    /* Length of the first path, including null */
  561.     int        pathLen2;    /* Length of the second path, including null */
  562.     char     *path1;        /* First pathname */
  563.     char     *path2;        /* Second pathname */
  564. } Fs_TwoPaths;
  565.  
  566. /*
  567.  * Information about a file system domain (volume).
  568.  */
  569. typedef struct {
  570.     int    maxKbytes;        /* Total Kbytes in the domain.  The allocation
  571.                  * routine might reserve some (%10) of this */
  572.     int    freeKbytes;        /* The number of available blocks.  This
  573.                  * reflects any reservations made by the
  574.                  * allocator.  If this is positive, blocks
  575.                  * are available. */
  576.     int    maxFileDesc;        /* The total number of files that can be
  577.                  * created in the domain. */
  578.     int    freeFileDesc;        /* The number of free file descriptors */
  579.     int blockSize;        /* Bytes per block */
  580.     int optSize;        /* Optimal transfer size, in bytes */
  581. } Fs_DomainInfo;
  582.  
  583.  
  584. /*
  585.  * User visible prefix table entry.  This is used by the routine that
  586.  * copies individual entries out to user programs.
  587.  */
  588. #define FS_USER_PREFIX_LENGTH    64
  589. #define FS_NO_SERVER        0
  590. typedef struct Fs_Prefix {
  591.     int serverID;        /* From FsFileID of prefix, FS_NO_SERVER if 
  592.                  * no handle */
  593.     int domain;            /* ditto */
  594.     int fileNumber;        /* ditto */
  595.     int version;        /* ditto */
  596.     int flags;            /* Defined below */
  597.     char prefix[FS_USER_PREFIX_LENGTH];
  598.     Fs_DomainInfo domainInfo;    /* Information about the domain. */
  599. } Fs_Prefix;
  600.  
  601. #ifndef FS_EXPORTED_PREFIX
  602. #define    FS_EXPORTED_PREFIX        0x1
  603. #define    FS_IMPORTED_PREFIX        0x2
  604. #define    FS_LOCAL_PREFIX            0x4
  605. #endif
  606.  
  607.  
  608. /*
  609.  * The Fs_ReadVector and Fs_WriteVector system calls take an array of
  610.  * I/O vectors. This allows data to be read to or written from non-contiguous
  611.  * areas of memory.
  612.  */
  613. typedef struct {
  614.     int        bufSize;    /* Size in bytes of the buffer */
  615.     Address    buffer;        /* For Fs_WriteVector, data to be written.
  616.                  * For Fs_ReadVector, place where read data 
  617.                  * is stored. */
  618. } Fs_IOVector;
  619.  
  620.  
  621. /*
  622.  * The structure below is use for creating devices with Fs_MakeDevice.
  623.  * It's also used internally by the kernel to hold the information passed
  624.  * to device specific routines so they can operate on their particular device.
  625.  */
  626. typedef struct Fs_Device {
  627.     int        serverID;    /* The host ID of the server that controls
  628.                  * the device. */
  629.     int        type;        /* The type of device.  This field is used to
  630.                  * index into an operation switch */
  631.     int        unit;        /* Type dependent unit specification. The
  632.                  * interpretation is up to the device driver */
  633.     /* 
  634.      * The rest of these fields are used only by the Sprite server.
  635.      */
  636.     mach_port_t    devPort;    /* handle returned by device_open */
  637.     mach_port_t mmapPort;    /* memory object returned by device_map */
  638.     ClientData    data;        /* Device type dependent data. This can be set
  639.                  * during the device open routine and should
  640.                  * be cleaned up in the device close routine. */
  641. } Fs_Device;
  642.  
  643. /*
  644.  * Definitions for the FS dispatcher library.
  645.  */
  646. typedef ClientData Fs_TimeoutHandler;
  647.  
  648. /* 
  649.  * Definitions for MIG-generated stubs.
  650.  */
  651. typedef char Fs_PathName[FS_MAX_PATH_NAME_LENGTH];
  652.  
  653. extern void            Fs_Dispatch();
  654. extern void            Fs_EventHandlerCreate();
  655. extern void             Fs_EventHandlerDestroy();
  656. extern ClientData         Fs_EventHandlerData();
  657. extern ClientData         Fs_EventHandlerChangeData();
  658. extern char            *Fs_GetTempName();
  659. extern int            Fs_GetTempFile();
  660. extern int                  Fs_IOControl();
  661. extern Boolean            Fs_IsATerm();
  662. extern Fs_TimeoutHandler    Fs_TimeoutHandlerCreate();
  663. extern void             Fs_TimeoutHandlerDestroy();
  664.  
  665. extern int                  Ioc_ClearBits();
  666. extern int                  Ioc_GetFlags();
  667. extern int                  Ioc_GetOwner();
  668. extern int                  Ioc_Lock();
  669. extern int                  Ioc_Map();
  670. extern int                  Ioc_NumReadable();
  671. extern int                  Ioc_SetBits();
  672. extern int                  Ioc_Reposition();
  673. extern int                  Ioc_SetFlags();
  674. extern int                  Ioc_SetOwner();
  675. extern int                  Ioc_Truncate();
  676. extern int                  Ioc_Unlock();
  677. extern int                  Ioc_WriteBack();
  678.  
  679. #endif /* _MiG */
  680. #endif /* _FS_H */
  681. @
  682.  
  683.  
  684. 1.2
  685. log
  686. @Put back stuff from regular user fs.h.  Change maximum path length
  687. back to 1024.  Add support for inclusion by MIG defs files.  Add
  688. constants to verify the sizes of MIG-generated types.  Add
  689. Mach-related fields to Fs_Device.  Get proc types from user proc.h.
  690. @
  691. text
  692. @d16 1
  693. a16 1
  694.  * $Header: /sprite/src/lib/include/RCS/fs.h,v 1.20 91/05/20 17:32:40 kupfer Exp $ SPRITE (Berkeley)
  695. d373 2
  696. d382 2
  697. @
  698.  
  699.  
  700. 1.1
  701. log
  702. @Initial revision
  703. @
  704. text
  705. @d16 1
  706. a16 1
  707.  * $Header: /sprite/lib/forms/RCS/proto.h,v 1.7 91/02/09 13:24:52 ouster Exp $ SPRITE (Berkeley)
  708. d22 9
  709. a30 1
  710. #define FS_MAX_PATH_NAME_LENGTH    4096
  711. d32 36
  712. d109 1
  713. d125 59
  714. d185 7
  715. d219 272
  716. d500 142
  717. @
  718.